from google.appengine.ext import db

from base_page import BaseHandler
from data import Pledge

class ViewPledgeHandler(BaseHandler):
  def ProcessGet(self):
    self.Setup('view_pledge.html', show_search_box=True)
    # get request
    pledge = self.GetEntityByKeyName('pid')
    if pledge == None:
      self.RedirectAndRaise('/')
    self.template_values['pledge'] = pledge
    self.template_values['req'] = pledge.request
    self.Render()

  def ProcessPost(self):
    pass

  def PreCheckOrRedirect(self):
    # every user can view a pledge
    return True
